<template>
<div class="wrapper">
  <swiper :options="swiperOption" v-if="swiperList.length">
    <!-- slides -->
    <swiper-slide v-for="item of swiperList" :key="item.id"><img class="swiper-img" :src="item.imgUrl"/></swiper-slide>
    <!-- Optional controls -->
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
</div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOption: {
        autoplay: 3000,
        loop: true,
        pagination: '.swiper-pagination',
        paginationClickable: true
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper>>>.swiper-pagination
    position: absolute
    z-index: 20
    bottom: 10px
    width: 100%
    text-align: center
.wrapper>>>.swiper-pagination-bullet
    display: inline-block
    width: 8px
    height: 8px
    border-radius: 8px
    background: #555
    margin: 0 5px
    opacity: 0.8
    border: 1px solid #fff
    cursor: pointer
.wrapper>>>.swiper-pagination-bullet-active
    background: #ccc
.wrapper
  width 100%
  height 0
  overflow hidden
  padding-bottom 30.5%
  .swiper-img
    width 100%
</style>
